package com.offlineanswer;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.offlineanswer.databinding.ItemAnswerBinding;

import java.util.List;

public class AnswerAdapter extends ArrayAdapter<String> {
    private static final int layoutId = R.layout.item_answer;
    private final Activity context;
    public AnswerAdapter(Activity context, List<String> objects){
        super(context,layoutId,objects);
        this.context=context;
    }
    @SuppressLint("SetTextI18n")
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        @SuppressLint("ViewHolder") ItemAnswerBinding itemAnswerBinding = ItemAnswerBinding.inflate(LayoutInflater.from(context));
        itemAnswerBinding.itemTv.setText(getItem(position));
        return itemAnswerBinding.getRoot();

    }
}